package LLParser;

import java.util.HashMap;
import java.util.Set;

public class ParseTable {

	private HashMap<String, HashMap<String, Integer>> tableMap;
	
	public ParseTable()
	{
		this.tableMap = new HashMap<String, HashMap<String, Integer>>();
	}
	
	public void addTransition(String rule, String terminal, int ruleNum)
	{
		if(tableMap.get(rule) == null)
			tableMap.put(rule, new HashMap<String, Integer>());
		
		tableMap.get(rule).put(terminal, ruleNum);
	}
	
	public int get(String rule, String terminal)
	{
		if(tableMap.get(rule) != null)
		{
			if(tableMap.get(rule).get(terminal) != null)
			{
				return tableMap.get(rule).get(terminal);
			}
		}
		
		return -1;
	}
}
